package vsfsfs5;
class Animalq {
    public void shout(){
        System.out.println("喵喵喵~~~");
    }
}
class Dnog extends Animalq {
    public void shout(){
        System.out.println("汪汪……");
    }
    public void eat(){
        System.out.println("吃肉……");
    }
}
public class Example17 {
    public static void main(String[] args) {
        Animalq a1 = new Dnog();
        System.out.println("instanceof判断a1是否是来自动物类"+(a1 instanceof Animalq) );
        System.out.println("instanceof判断a1是否是来自狗类"+(a1 instanceof Dnog) );
        Animalq a2 = new Dnog();
        System.out.println("instanceof判断a2是否是来自动物类"+(a2 instanceof Animalq) );
        System.out.println("instanceof判断a2是否是来自狗类"+(a2 instanceof Dnog) );
    }
}